#pragma once
#include <atlsecurity.h>

//-------------------------------------------------------------------------------
class security_identifier
{
public:
	static security_identifier create_well_known(WELL_KNOWN_SID_TYPE sid_type, PSID domain = NULL);

public:
	security_identifier(void){}
	security_identifier(const SID& sid);
	security_identifier(const ATL::CSid& sid);
	security_identifier(const std::wstring& string_sid);
	security_identifier(const std::wstring& account_name, const std::wstring& computer_name);
	virtual ~security_identifier(){}
	
	property_get(std::wstring, account_name);
	property_get(std::wstring, domain_name);
	property_get(std::wstring, full_name);
	property_get(std::wstring, as_string);
	property_get(const SID*, sid);
	property_get(bool, is_valid);
	property_get(SID_NAME_USE, type);
	
	bool set(const SID& sid);
	bool set(const CSid& sid);
	bool set(const std::wstring& string_sid);
	bool set(const std::wstring& account_name, const std::wstring& computer_name);
	
	operator const SID& ();
	operator SID* ();
	operator ATL::CSid& ();

protected:
	CSid _sid;
};
//-------------------------------------------------------------------------------
